<?php

/**
 * 最新更新 
 *
 * @author Jensen
 */
class newest extends AbstractAction {

    public function run() {
        global $TPL, $categoryMap;

        $page = intval($_GET['p']);
        if (empty($page)) {
            $page = 1;
        }

        $itemDAO = new BTItemsDAO();
        $cids = array(1, 5, 8, 11, 26, 21);
        $items = $itemDAO->GetLatestItems($cids, PERPAGE, $page);
        // only get latest 100 items
        $limit = 100;
        if (debug) {
            $pager = new Pager('index.php?action=newest&id=' . $cid, $limit, PERPAGE, $page, 'p');
        } else {
            $pager = new Pager(__CLASS__ . '?id=' . $cid, $limit, PERPAGE, $page, 'p');
        }

        $TPL->assign('current_page', 'newest');
        $TPL->assign('items', $items);
        $TPL->assign('pager', $pager->getBar());
        $TPL->display('newest.tpl');
    }

}

?>
